home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Resources / JawsPDF Creator / JawsPdfCreatorEn.exe / Disk1 / data1.cab / InstDirResource / procset / cidinit.ps < prev    next >
Encoding:
Text File  |  2003-08-08  |  6.2 KB  |  256 lines

  1. %!
  2. %%VMusage: 0 0
  3. %%VMlocation: global
  4. %%
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. %%                                    %%
  7. %% CIDInit: the procedures used when defining CMap and CIDfont        %%
  8. %% resources.  The implementation is more or less defined by the    %%
  9. %% requirement of the composefont procedure in systemdict.        %%
  10. %%                                    %%
  11. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  12.  
  13. /CIDInit <<
  14.  
  15. /cid_Setup {} bind
  16.  
  17. /begincmap {
  18.   /CodeSpace [] def
  19.   /CIDRange [] def
  20.   /CIDIndex 0 def
  21.   /NotDefRange [] def
  22.   /NotDefIndex 0 def
  23.   /BFRange [] def
  24.   /BFIndex 0 def
  25.   /FontIndex 0 def
  26.   /FontMatrices 1 dict def
  27. } bind
  28.  
  29. /endcmap {
  30.   currentdict systemdict begin definecmap end
  31.   currentdict /CodeSpace undef
  32.   currentdict /CIDRange undef
  33.   currentdict /NotDefRange undef
  34.   currentdict /BFRange undef
  35. } bind
  36.  
  37. /beginrearrangedfont {
  38.   32 dict begin 
  39.   /FDepVector exch def
  40.   /FontName exch def
  41.   /FontMatrices 1 dict def
  42.   begincmap
  43. } bind
  44.  
  45. /endrearrangedfont {
  46.   0 1 FDepVector length 1 sub {
  47.     /ind exch def
  48.     FDepVector ind get
  49.     dup type /nametype eq {
  50.       dup /CIDFont resourcestatus {
  51.         pop pop /CIDFont findresource
  52.       } {
  53.         findfont
  54.       } ifelse
  55.     } if
  56.     FontMatrices ind known {
  57.       FontMatrices ind get makefont
  58.     } if
  59.     FDepVector ind 3 -1 roll put
  60.   } for
  61.  
  62.     FDepVector 0 get
  63.     dup type /nametype eq {
  64.       dup /CIDFont resourcestatus {
  65.         pop pop /CIDFont findresource
  66.       } {
  67.         findfont
  68.       } ifelse
  69.     } if
  70. /WMode get /WMode exch def
  71.   currentdict definerearrangedcmap
  72.   currentdict /CodeSpace undef
  73.   currentdict /CIDRange undef
  74.   currentdict /NotDefRange undef
  75.   currentdict /BFRange undef
  76.   currentdict /FontMatrices undef
  77.   FontName currentdict FDepVector
  78.   end
  79.   composefont
  80. } bind
  81.  
  82. /usefont {
  83.   /FontIndex exch def
  84. } bind
  85.  
  86. /beginusematrix {
  87. } bind
  88.  
  89. /endusematrix {
  90.   FontMatrices 3 1 roll put
  91. } bind
  92.  
  93. /usecmap {
  94.   /UseCMap exch /CMap findresource def
  95. } bind
  96.  
  97. /begincodespacerange {
  98.   2 mul CodeSpace length add array
  99.   dup 0 CodeSpace putinterval
  100.   /CodeSpace exch def
  101.   mark
  102. } bind
  103.  
  104. /endcodespacerange {
  105.   ] dup length neg CodeSpace length add exch
  106.   CodeSpace 3 1 roll putinterval
  107. } bind
  108.  
  109. /begincidrange {
  110.   4 mul CIDIndex add array
  111.   dup 0 CIDRange putinterval
  112.   /CIDRange exch def
  113. } bind
  114.  
  115. /begincidchar 1 index
  116.  
  117. /endcidrange {
  118.   CIDRange length 4 sub -4 CIDIndex {
  119.     CIDRange 1 index 3 add 4 -1 roll put
  120.     CIDRange 1 index 2 add FontIndex put
  121.     CIDRange 1 index 1 add 4 -1 roll put
  122.     CIDRange exch 3 -1 roll put
  123.   } for
  124.   /CIDIndex CIDRange length def
  125. } bind
  126.  
  127. /endcidchar {
  128.   CIDRange length 4 sub -4 CIDIndex {
  129.     CIDRange 1 index 3 add 4 -1 roll put
  130.     CIDRange 1 index 2 add FontIndex put
  131.     CIDRange 1 index 1 add 3 index put
  132.     CIDRange exch 3 -1 roll put
  133.   } for
  134.   /CIDIndex CIDRange length def
  135. } bind
  136.  
  137. /beginbfrange {
  138.   4 mul BFIndex add array
  139.   dup 0 BFRange putinterval
  140.   /BFRange exch def
  141. } bind
  142.  
  143. /beginbfchar 1 index
  144.  
  145. /endbfrange {
  146.   BFRange length 4 sub -4 BFIndex {
  147.     BFRange 1 index 3 add 4 -1 roll put
  148.     BFRange 1 index 2 add FontIndex put
  149.     BFRange 1 index 1 add 4 -1 roll put
  150.     BFRange exch 3 -1 roll put
  151.   } for
  152.   /BFIndex BFRange length def
  153. } bind
  154.  
  155. /endbfchar {
  156.   BFRange length 4 sub -4 BFIndex {
  157.     BFRange 1 index 3 add 4 -1 roll put
  158.     BFRange 1 index 2 add FontIndex put
  159.     BFRange 1 index 1 add 3 index put
  160.     BFRange exch 3 -1 roll put
  161.   } for
  162.   /BFIndex BFRange length def
  163. } bind
  164.  
  165. /beginnotdefrange {
  166.   4 mul NotDefIndex add array
  167.   dup 0 NotDefRange putinterval
  168.   /NotDefRange exch def
  169. } bind
  170.  
  171. /beginnotdefchar 1 index
  172.  
  173. /endnotdefrange {
  174.   NotDefRange length 4 sub -4 NotDefIndex {
  175.     NotDefRange 1 index 3 add 4 -1 roll put
  176.     NotDefRange 1 index 2 add FontIndex put
  177.     NotDefRange 1 index 1 add 4 -1 roll put
  178.     NotDefRange exch 3 -1 roll put
  179.   } for
  180.   /NotDefIndex NotDefRange length def
  181. } bind
  182.  
  183.  
  184. /endnotdefchar {
  185.   NotDefRange length 4 sub -4 NotDefIndex {
  186.     NotDefRange 1 index 3 add 4 -1 roll put
  187.     NotDefRange 1 index 2 add FontIndex put
  188.     NotDefRange 1 index 1 add 3 index put
  189.     NotDefRange exch 3 -1 roll put
  190.   } for
  191.   /NotDefIndex NotDefRange length def
  192. } bind
  193.  
  194. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  195. %%                                    %%
  196. %% StartData just builds an appropriate CIDFont dictionary and        %%
  197. %% passes it to definefont.  We take the lazy way out for        %%
  198. %% hex-encoded CID fonts and read them into a GlyphData string,    %%
  199. %% exploiting the fact that Jaws supports strings of arbitrary        %%
  200. %% length.                                %%
  201. %%                                    %%
  202. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  203.  
  204. /StartData {
  205. %%
  206. %% This checks to see if we have been called as a result of
  207. %% FindResource. We leave 2 copies of the result on the stack.
  208. %% One is for the test  against a seekable file, the other is 
  209. %% for the end of the procedure, where we close currentfile
  210. %% but only if we were called as a result of FindResource
  211. %%
  212.   false countexecstack array execstack {
  213.     /@findresource eq {pop true exit} if
  214.   } forall
  215.   dup 4 2 roll
  216.  
  217.   /GlyphData exch def
  218.   dup (hex) eq exch (Hex) eq or {
  219.     /GlyphData GlyphData string def
  220.     GlyphData length 0 ne {
  221.       currentfile /ASCIIHexDecode filter GlyphData readstring pop pop
  222.     } if
  223.     pop
  224.   } {
  225.     currentglobal % remember the VM mode
  226.     {currentfile fileposition} stopped
  227.     3 -1 roll setglobal % reinstate VM mode (in case fileposition errored)
  228.     exch pop exch not or {
  229.       currentglobal currentdict gcheck setglobal
  230.       /GlyphData GlyphData string def
  231.       setglobal
  232.       GlyphData length 0 ne {
  233.         currentfile GlyphData readstring pop pop
  234.       } if
  235.     } {
  236.       /CIDFile currentfile def
  237.     } ifelse
  238.   } ifelse
  239.   currentdict /CDevProc known not {
  240.     currentglobal currentdict gcheck setglobal
  241.     /CDevProc [
  242.       /pop load dup dup dup dup 0 -1
  243.       FDArray 0 get /FontMatrix get 0 get
  244.       div 7 /index load 2 /div load 4 index -.88 mul] cvx
  245.     def
  246.     setglobal
  247.   } if
  248.   CIDFontName currentdict definefont
  249.   CIDFontName end exch /CIDFont defineresource pop
  250.   end
  251.   {currentfile closefile} if
  252. } bind
  253.  
  254. >> /ProcSet defineresource
  255.  
  256.